package com.jinx.demo_log.controller;

import com.jinx.demo_log.annotation.JinxLog;
import com.jinx.demo_log.domain.User;
import com.jinx.demo_log.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;

/**
 * 用户接口
 * 所有用户api
 * @module 111
 * @author lsx
 * @date 2020/6/5 下午2:25
 */
@RequestMapping(value = "/user")
@RestController
public class UserController {

    @Autowired
    private UserService userService;

    /**
     * 用户查询
     * 用户列表查询
     * @param parm 参数
     * @return {@link Object}
     */
    @JinxLog(title = "用户查询")
    @GetMapping(value = "/list")
    public Object list(String parm){
        return userService.selectList(null);
    }

    /**
     * 添加用户
     * @param user
     * @return
     */
    @JinxLog(title = "添加用户",uniqueKey = "orderId")
    @PostMapping(value = "/add")
    public Object add(@RequestBody User user){
        //boolean save = userService.insert(user);
        HashMap<String, Object> map = new HashMap<>();
        map.put("code",200);
        //map.put("msg",save==true?"操作成功":"操作失败");
        return map;
    }
}
